/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2025-03-21 20:48:08
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2025-03-21 20:48:13
 * @FilePath: /lesson/Thread_ring_queue/Task.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#pragma once

#include<iostream>
#include<pthread.h>

using namespace std;

class Task
{

public:
    Task()
    {

    }
    Task(int x,int y):_x(x),_y(y)
    {

    }

    void Execute()
    {
        _result= _x+_y;
    }

    void operator()()
    {
        Execute();// 直接用仿函数() 调佣 Execute();
    }

    // 添加一个debug函数为了方便打印!
    string debug()
    {
        string msg= to_string(_x) + " + " + to_string(_y) + " = ? ";
        return msg;
    }

    string result()
    {
        string msg=to_string(_x) + " + " + to_string(_y) + " = " + to_string(_result);
        return msg;
    }
    ~Task()
    {

    }

private:
    int _x;
    int _y;
    int _result;
};